<div id="select-bar">

<h1>Requirements Listing</h1>
    <%= form_remote_tag(:update => "issue-list",
        :url => { :action => :update_list },
        :position => "top" ) %>
    <div class="selects">
    <%= submit_tag 'Refresh' %>&nbsp;
    <label for="arg1"><i>project</i></label>&nbsp; 
    <% @keys = Project.find(:all).map {|k| [k.key, k.key]} %>
    <%= select(:arg1, nil , @keys) %>

    <label for="arg2"><i>version</i></label>&nbsp; 
    &nbsp;<% @versions = Version.find(:all).map {|v| [v.name, v.name]} %>
    <%= select(:arg2, nil , @versions) %>

    <label for="arg3"><i>category</i></label>&nbsp; 
    &nbsp;<% @categories = ProjectCategory.find(:all).map {|c| [c.category, c.category]} %>
    <%= select(:arg3, nil, @categories) %>
    </div>
    <%= end_form_tag %>
</div>
<div id="issue-list">
    <table>
        <tr>
    <th>Key</th>
    <th>Specification</th>
    <th>Create Date</th>
    <th colspan="3">Operations</th>
  </tr>
    
<% for requirement in @requirements %>
  <tr class="<%= cycle('list-line-odd', 'list-line-even') %>">
    <td><%= h requirement.affected_project + "-" + requirement.id.to_s %></td>
    <td><%= h requirement.specification %></td>
    <td><%= h requirement.create_date %></td>

    <td><%= link_to 'Show', :action => 'show', :id => requirement %></td>
    <td><%= link_to 'Edit', :action => 'edit', :id => requirement %></td>
    <td><%= link_to 'Destroy', { :action => 'destroy', :id => requirement }, :confirm => 'Are you sure?', :method => :post %></td>
  </tr>
<% end %>
</table>
</div>
<%= link_to 'Previous page', { :page => @requirement_pages.current.previous } if @requirement_pages.current.previous %>
<%= link_to 'Next page', { :page => @requirement_pages.current.next } if @requirement_pages.current.next %> 

<br />

<%= link_to 'New requirement', :action => 'new' %>
